﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Windows.Data;

namespace sys_Print.Converter
{
    public class PixelToMmConverter : IValueConverter
    {
        public double Dpi { get; set; } = 96.0; // 默认 DPI，根据需要更改

        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value is double millimeters)
            {
                double pixels = (millimeters * Dpi) / 25.4;
                return pixels;
            }
            return value;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
